/*
 * @Author: 白袂 1741866590@qq.com
 * @Date: 2023-09-17 13:03:31
 * @LastEditors: 白袂 1741866590@qq.com
 * @LastEditTime: 2023-09-18 19:18:19
 * @FilePath: \obj_end_2023_9_17\mock\order.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
let Mock = require("mockjs")
module.exports = {
    transaction(req) {
        //接受用户的id  eg: req.userId 
        // console.log('req', req)
        let data = [];
        let transactionType = ["消费", "退款"];
        // let ind = Math.floor(Math.random() * 2);
        for(let i = 0; i < 7; i++) {
            let pu = {
                oderNo: Mock.mock('@natural(2001, 2999)'),
                oderName: Mock.mock('@cword(3)'),
                orderPrice: Mock.mock('@natural(100, 1000)'),
                orderPayFun: Mock.mock('@natural(1, 6)'),  // 1-6支付方式
                orderPayMoneny: Mock.mock('@natural(1, 100)'),  //支付金额
                orderTransactionType: transactionType[Math.floor(Math.random() * 2)],  ///退款
                orderstatus: Mock.mock('@natural(1, 7)'),      //订单状态1-7
                orderCreateTime: Mock.mock('@datetime()')
            }
            data.push(pu);
        }
        return {
            code: 200,
            message: "成功",
            data: data 
        }
    },
    statistics(req) {
        let data = [];
        let activeChartData = [];
        let radChartData = [];
        let basChartData = [];
        for (let i = 0; i < 6; i++) {
            activeChartData.push(Mock.mock('@csentence(3,5)'));
            radChartData.push({
                value: Mock.mock('@natural(20, 100)'),
                name: Mock.mock('@csentence(3,5)')
            });
            let bas = [];
            for(let j = 0; j < 7; j++) {
                bas.push(Mock.mock('@natural(0, 100)'))
            }
            basChartData.push({
                data: bas,
                type: 'line',
                smooth: true
            })
        }
        // for(let i = 0; i < 7; i++) {
        //     let pu = {
        //         oderNo: Mock.mock('@natural(2001, 2999)'),
        //         oderName: Mock.mock('@cword(3)'),
        //         orderPrice: Mock.mock('@natural(100, 1000)'),
        //         orderPayFun: Mock.mock('@natural(1, 6)'),  // 1-6支付方式
        //         orderPayMoneny: Mock.mock('@natural(1, 100)'),  //支付金额
        //         orderTransactionType: transactionType[ind],  ///退款
        //         orderstatus: Mock.mock('@natural(1, 7)'),      //订单状态1-7
        //         orderCreateTime: Mock.mock('@datetime()')
        //     }
        //     data.push(pu);
        // }
        return {
            code: 200,
            message: "成功",
            data: {
                activeChartData,
                radChartData,
                basChartData
            } 
        }
    }
}